package com.java.service.impl;

import com.java.entity.Locationinfo;
import com.java.dao.LocationinfoDao;
import com.java.service.LocationinfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Locationinfo)表服务实现类
 *
 * @author makejava
 * @since 2021-01-20 18:54:56
 */
@Service("locationinfoService")
public class LocationinfoServiceImpl implements LocationinfoService {
    @Resource
    private LocationinfoDao locationinfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param lId 主键
     * @return 实例对象
     */
    @Override
    public Locationinfo queryById(Integer lId) {
        return this.locationinfoDao.queryById(lId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<Locationinfo> queryAllByLimit(int offset, int limit) {
        return this.locationinfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param locationinfo 实例对象
     * @return 实例对象
     */
    @Override
    public Locationinfo insert(Locationinfo locationinfo) {
        this.locationinfoDao.insert(locationinfo);
        return locationinfo;
    }

    /**
     * 修改数据
     *
     * @param locationinfo 实例对象
     * @return 实例对象
     */
    @Override
    public Locationinfo update(Locationinfo locationinfo) {
        this.locationinfoDao.update(locationinfo);
        return this.queryById(locationinfo.getLId());
    }

    /**
     * 通过主键删除数据
     *
     * @param lId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer lId) {
        return this.locationinfoDao.deleteById(lId) > 0;
    }
}